<template>
    <fs-page>
       {{ data }}
    </fs-page>
</template>
<script>
import { request } from '/@/utils/service';
export const apiPrefix = '/api/ele_meter/';


 function getData(params) {
  request({
    url: '/api/ele_meter/',
    params: 'get'
  }).then(res => {
    //this.data = res.data
    const { data } =  res.data;
  })

}
export default {
  data() {
    return {
      data: null,
      loading: true,
      error: null,
    };
  },
  async created() {
this.data='1';
//getData();
//this.data=data;
  const {data, page, limit, total} = await request({
    url:'/api/ele_meter/',
    params:''
  })
 // this.data=data;
    this.fetchData();

  },

 methods: {
    async fetchData() {
      this.loading = true;
      this.error = null;
      try {
        const response = await fetch('http://nhapi.yunjichaobiao.com/WebApi/NH2/WatermeterBasicInfo', {
          method: 'POST',
          headers: {
            'API_KEY': 'EB663156FEE34A618D4DB246F89FA663',
           'Content-Type': 'application/json',
          },
          body: JSON.stringify({}), // 替换为你的数据
        });
        if (!response.ok) {
          throw new Error('Network response was not ok ' + response.statusText);
        }
        const data = await response.json();
        this.data = data;
      } catch (error) {
        this.error = 'API请求失败: ' + error.message;
      } finally {
        this.loading = false;
      }
    },
  },
};
</script>
